package errmsg

const (
	SUCCSE               = 200
	SUCCESS_REIGISTER    = 201
	SUCCESS_LOGIN        = 202
	ERROR                = 500
	ERROR_INVALID_PARAMS = 1009
	// code= 1000... 用户模块的错误
	ERROR_USERNAME_USED      = 1001
	ERROR_PASSWORD_WRONG     = 1002
	ERROR_USER_NOT_EXIST     = 1003
	ERROR_TOKEN_EXIST        = 1004
	ERROR_TOKEN_RUNTIME      = 1005
	ERROR_TOKEN_WRONG        = 1006
	ERROR_TOKEN_TYPE_WRONG   = 1007
	ERROR_USER_NO_RIGHT      = 1008
	ERROR_USER_LENOFFW_LESS6 = 1010
	// code= 2000... 文章模块的错误

	ERROR_ART_NOT_EXIST = 2001
	// code= 3000... 分类模块的错误
	ERROR_CATENAME_USED  = 3001
	ERROR_CATE_NOT_EXIST = 3002

	PARM_NOT_RIGHT   = 4001
	COOKIE_NOT_EXIST = 4002

	Email_Not_Ready = 5001
	Email_No_Toer   = 5002
	Email_Param_Err = 5003
	Email_Has_Ready = 5000
)

var codeMsg = map[int]string{
	SUCCSE:                   "OK",
	SUCCESS_REIGISTER:        "注册成功",
	SUCCESS_LOGIN:            "登录成功",
	ERROR:                    "FAIL",
	ERROR_USERNAME_USED:      "用户名已存在！",
	ERROR_PASSWORD_WRONG:     "密码错误",
	ERROR_USER_NOT_EXIST:     "用户不存在",
	ERROR_TOKEN_EXIST:        "TOKEN不存在,请重新登陆",
	ERROR_TOKEN_RUNTIME:      "TOKEN已过期,请重新登陆",
	ERROR_TOKEN_WRONG:        "TOKEN不正确,请重新登陆",
	ERROR_TOKEN_TYPE_WRONG:   "TOKEN格式错误,请重新登陆",
	ERROR_USER_NO_RIGHT:      "该用户无权限",
	ERROR_USER_LENOFFW_LESS6: "密码小于6",

	ERROR_CATENAME_USED:  "该分类已存在",
	ERROR_CATE_NOT_EXIST: "该分类不存在",
	ERROR_INVALID_PARAMS: "自定：没有请求Token",
	PARM_NOT_RIGHT:       "parm is not right",
	COOKIE_NOT_EXIST:     "cookie信息错误",

	Email_Not_Ready: "邮件没有配置完成",
	Email_No_Toer:   "越级非法操作，邮件没有设置收件人",
	Email_Param_Err: "参数错误",
	Email_Has_Ready: "邮件准备完成",
}

func GetErrMsg(code int) string {
	return codeMsg[code]
}
